<div class="main-content">
	<div class="breadcrumbs" id="breadcrumbs">

		<ul class="breadcrumb">
			<li>
				<i class="icon-home home-icon"></i>
				<a href="#">系统首页</a>
			</li>
			<li class="active">
				基础数据管理
			</li>
            <li>
				<a href="#">设备供应商</a>
			</li>
            <li class="active">
				编辑
			</li>
		</ul><!-- .breadcrumb -->
	</div>
	<div class="page-content">
        
        <div class="page-header">
			<h1>编辑设备大类</h1>
		</div>
		<div class="row">
			 <div class="col-xs-12">
				<!-- PAGE CONTENT BEGINS -->
					<form id="usrform" action="<?php echo base_url()."admin/basis_data/edit_device_category/".$device_category->id;?>" method="post">
						<input type="hidden" name="device_category_id" value="<?php if (isset($device_category->id))echo $device_category->id;?>">
				    	<div class="box-body" style="display: inline-block;width: 100%">
					        <div class="form-group col-xs-6">
					            <label>一级编码</label><span style="color: #a94442;"><?php echo form_error("name")?></span>
					            <input name="number" type="text" class="form-control" placeholder="输入 ..." value="<?php if (validation_errors()!='')echo set_value('number');elseif (isset($device_category->number))echo $device_category->number;?>" check-type="required">
				            </div>
	                        <div class="form-group col-xs-6">
					            <label>大类名称</label><span style="color: #a94442;"><?php echo form_error("people")?></span>
					            <input name="name" type="text" class="form-control" placeholder="输入 ..." value="<?php if (validation_errors()!='')echo set_value('name');elseif (isset($device_category->name))echo $device_category->name;?>" check-type="required">
				            </div>
				            <div class="form-group col-xs-6">
					            <label>排序</label><span style="color: #a94442;"><?php echo form_error("people")?></span>
					            <input name="sort" type="text" class="form-control" placeholder="输入 ..." value="<?php if (validation_errors()!='')echo set_value('sort');elseif (isset($device_category->sort))echo $device_category->sort;?>" check-type="required">
				            </div>
				            <div class="wh">
					             <label>种类</label><span style="color: #a94442;"><?php echo form_error("people")?></span>
					             <select name="device_type" id="device_type">
					             <option value="">请选择种类</option>
								 <option value="1" <?php if (isset($device_category)&&$device_category->device_type == 1)echo "selected";?>>类型1（货车）</option>
								 <option value="0" <?php if (isset($device_category)&&$device_category->device_type == 0)echo "selected";?>>类型2（叉车）</option>
								 </select>
				            </div>
				            <div class="form-group col-xs-6">
				            	<div id="select" style="width: 150px; margin-bottom: 20px;">
		  							<input type="hidden" id="url" name="img_url" value="<?php if(isset($device_category->img_url)){ echo $device_category->img_url; }?>" check-type="required">
		    						<img id="headpic" style="width: 100%;" src="<?php if(isset($device_category->img_url)){ echo $device_category->img_url; }?>" />
								</div>
								<div><a class="btn_style" onClick='del_img()' >删除logo</a></div>
			            	</div>
	                        <!--<div class="form-group col-xs-6">
					            <label>省</label><span style="color: #a94442;"></span>
					                <select id="province" name="province" class="province" style="width: 100%;" check-type="required">
					                    <option value="">省</option>
					                </select>
			                </div>
			                <div class="form-group col-xs-6">
			                    <label>市</label><span style="color: #a94442;"></span>
					                <select id="city" name="city" class="city" style="width: 100%;" check-type="required">
					                    <option value="">市</option>
					                </select>
			                </div>
			                <div class="form-group col-xs-6">
			                    <label>县区</label><span style="color: #a94442;"></span>
					                <select id="area" name="area" class="area" style="width: 100%;" check-type="required">
					                    <option value="">县区</option>
					                </select>
					            
				            </div>
				            <div class="form-group col-xs-6">
				                 <label>详细地址</label><span style="color: #a94442;"></span>
				                 <input name="address" type="text" class="form-control" placeholder="输入 ..." value="" check-type="required">
				            </div>
				            <div class="form-group col-xs-6">
					            <label>联系方式</label><span style="color: #a94442;"></span>
					            <input name="telephone" type="text" class="form-control" placeholder="输入 ..." value="" check-type="required">
				            </div>-->
			            </div>
			            <div class="clearfix form-actions">
							<div class="col-md-offset-3 col-md-9">
								<button id="btnSubmit" class="btn btn-info" type="submit">
									<i class="icon-ok bigger-110"></i>
									保存
								</button>
	
								&nbsp; &nbsp; &nbsp;
								<a class="btn" href="<?php echo base_url()."admin/basis_data/device_category"?>">
									<i class="icon-undo bigger-110"></i>
									返回
								</a>
							</div>
						</div>
					</form>
			</div>
		</div><!-- /.row -->
	</div><!-- /.page-content -->
</div><!-- /.main-content -->
				<script type="text/javascript">
	$("#usrform").validation();
	//保存
	$("#btnSubmit").on('click',function(event){
	  // 2.最后要调用 valid()方法。
	  if ($("#usrform").valid()==false){
	    return false;
	  }
	});
	</script>
	</script>
		<script>
	function del_img(){
		$('#headpic').attr('src','<?php echo base_url()?>themes/default/images/photo_icon.png');
        $('#url').val('');
	}
    $(function () {
        var uploader = null;
        //上传初始化
		if(uploader==null){
        	uploader = WebUploader.create({
        	    // 选完文件后，是否自动上传。
        	    auto: true,
        	    //不压缩图像
        	    compress:false,
        	    // swf文件路径
        	    swf:'<?php echo base_url()?>themes/webuploader/Uploader.swf',
        	    // 文件接收服务端。
        	    server: '<?php echo site_url("admin/upyun/webuploader")?>',
        	    // 选择文件的按钮。可选。
        	    // 内部根据当前运行是创建，可能是input元素，也可能是flash.
        	    pick: '#select',
        	    // 只允许选择图片文件。
        	    accept: {
        	        title: 'Images',
        	        extensions: 'gif,jpg,jpeg,bmp,png',
        	        mimeTypes: 'image/*'
        	    }
        	});
        	//文件上传成功，显示图片。
        	uploader.on('uploadSuccess', function(file,response) {
        		$('#headpic').attr('src',response.file_path);
        		uploader.reset();
        		$('#url').val(response.file_path);
        	});

        	// 文件上传失败，显示上传出错。
        	uploader.on( 'uploadError', function( file ) {
        		$('#error').html('上传失败');
        		$('#error').show();
        	});
		}
    });
    </script>